package com.huawei.M01.iterator.F05;

import java.util.HashSet;
import java.util.Set;

public class Test {
    public int commonFactors(int a, int b) {
        int greatCommon = gcb(a, b);

        return getCommonFactor(greatCommon);
    }

    private int getCommonFactor(int greatCommon) {
        int result = 0;
        for (int i = 1; i <= greatCommon; i++) {
            if (greatCommon % i == 0) {
                result++;
            }
        }
        return result;
    }

    private int gcb(int a, int b) {
        return b == 0 ? a : gcb(b, a % b);
    }

    public static void main(String[] args) {
        System.out.println(new Test().commonFactors(6, 0));
    }
}
